package Test;

import Dao.Implement.userDaoImplement;
import Dao.userDao;
import Service.userService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import pojo.room;
import pojo.user;

import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.sql.Date;

public class userDaoImplementTest {

    private userDao userDaoGet(){
        ApplicationContext context=new ClassPathXmlApplicationContext("bean1.xml");
        userDao userDao=context.getBean("userDaoImplement", userDaoImplement.class);
        return userDao;
    }



    @Test
    public void loginInTest(){
        userDao userDao=userDaoGet();
        System.out.println(userDao.loginIn("10205101426"));
    }
    @Test
    public void queryUserByIDTest(){
        userDao userDao=userDaoGet();
        System.out.println(userDao.queryUserByID(new Long("1")));
    }
    @Test
    public void queryUserByStudentIdTest(){
        userDao userDao=userDaoGet();
        System.out.println(userDao.queryUserByStudentId("10205101426"));
    }

    @Test
    public void registerTest(){
        userDao userDao=userDaoGet();
        System.out.println(userDao.register("10101","ss","asd"));
    }
    @Test
    public void sendMessageTest(){
        userDao userDao=userDaoGet();
        System.out.println(userDao.sendMessage(Long.parseLong("1"),Long.parseLong("121"),"hello"));
    }

    @Test
    public void receiveMessageTest(){
        userDao userDao=userDaoGet();
        System.out.println(userDao.receiveMessage(Long.parseLong("5")));
    }

    @Test
    public void queryPlaygroundListByStadiumIDTest(){
        userDao userDao=userDaoGet();
        System.out.println(userDao.queryPlaygroundListByStadiumID(Long.parseLong("1"),"3"));
    }

    @Test
    public void queryStadiumBySportsIdTest(){
        userDao userDao=userDaoGet();
        System.out.println(userDao.queryStadiumBySportsId("3"));

    }

    @Test
    public void queryUserIDByRoomID(){
        userDao userDao=userDaoGet();
        System.out.println(userDao.queryUserIDByRoomID(Long.parseLong("1")));
    }
    @Test
    public void queryRoom(){
        userDao userDao=userDaoGet();
        System.out.println(userDao.queryRoom());
    }
    @Test
    public void queryStadiumByName(){
        userDao userDao=userDaoGet();
        System.out.println(userDao.queryStadiumByName("大学生活动中心羽毛球馆"));
    }
    @Test
    public void queryStadiumBySportsId(){
        userDao userDao=userDaoGet();
        System.out.println(userDao.queryStadiumBySportsId("3"));
    }
    @Test
    public void queryPlaygroundByName(){
        userDao userDao=userDaoGet();
        System.out.println(userDao.queryPlaygroundByName(Long.parseLong("1"),"羽毛球一号场"));
    }

    @Test
    public void queryRoomById(){
        userDao userDao=userDaoGet();
        System.out.println(userDao.queryRoombyRoomID(Long.parseLong("22")));
    }




    }


